# -*- coding: utf-8 -*-
import oss2
import math

count = 0
# 阿里云账号AccessKey拥有所有API的访问权限，风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维，请登录RAM控制台创建RAM用户。
auth = oss2.Auth('LTAI5tM5bDSACkr17DNjpWHV', 'tYg7NTlmNl7KfAK03QHAIa5fCGP9GT')
# 填写Bucket所在地域对应的Endpoint。以华东1（杭州）为例，Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
# 填写Bucket名称，例如examplebucket。
bucket_list = ['chspu-img',
               'wenwo-audio-bucket-dev',
               'wenwo-audio-bucket-prd',
               'wenwo-audio-bucket-test',
               'wenwo-file-bucket-dev',
               'wenwo-file-bucket-prd',
               'wenwo-file-bucket-test',
               'wenwo-file-bucket-uat',
               'wenwo-img-bucket-dev',
               'wenwo-img-bucket-prd',
               'wenwo-img-bucket-test',
               'wenwo-img-bucket-uat',
               'wenwo-office-bucket-dev',
               'wenwo-office-bucket-prd',
               'wenwo-office-bucket-test',
               'wenwo-public-video',
               'wenwo-static-pro',
               'wenwo-static-test',
               'ww-dev-v-out',
               'ww-dev-v-src',
               'ww-v-out',
               'ww-v-src']
for i in bucket_list:
    bucket = oss2.Bucket(
        auth, 'oss-cn-beijing.aliyuncs.com', i)
    # 列举Bucket下所有文件。
    for obj in oss2.ObjectIterator(bucket):
        count = count+1
print(count)
